{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "084b4637",
   "metadata": {},
   "outputs": [],
   "source": [
    "face_detect_url = \"https://api-cn.faceplusplus.com/facepp/v3/detect\"\n",
    " \n",
    "\n",
    "payload = {\n",
    "    'api_key':'iFunMsDgsjGWluC2dute5E7jpaBYrlVI',\n",
    "    'api_secret':'A0tYfYO1sdLKEjUSZVDbe4Rh49lbLsmn',\n",
    "    'image_url':'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhbimg.b0.upaiyun.com%2Ff1cb86852dae9af5763b1a0a4d3f3f11eebbd29fa922-pMZnvq_fw658&refer=http%3A%2F%2Fhbimg.b0.upaiyun.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1658944444&t=36820d354490de04209a4aff001688fb',\n",
    "    'return_landmark':1,\n",
    "    'return_attributes':'gender,age,smiling,emotion'\n",
    "}\n",
    "\n",
    "\n",
    "r =  requests.post(url = face_detect_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b067dbca",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "2253552f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "7ff145ad",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'request_id': '1656778215,e27f8bc1-9c94-4272-af9c-1e026741b6da',\n",
       " 'time_used': 240,\n",
       " 'faces': [{'face_token': '6b91860891b80c740d235569f998b2c4',\n",
       "   'face_rectangle': {'top': 118, 'left': 108, 'width': 130, 'height': 130},\n",
       "   'landmark': {'contour_chin': {'x': 152, 'y': 244},\n",
       "    'contour_left1': {'x': 119, 'y': 133},\n",
       "    'contour_left2': {'x': 116, 'y': 147},\n",
       "    'contour_left3': {'x': 113, 'y': 161},\n",
       "    'contour_left4': {'x': 112, 'y': 176},\n",
       "    'contour_left5': {'x': 110, 'y': 190},\n",
       "    'contour_left6': {'x': 111, 'y': 205},\n",
       "    'contour_left7': {'x': 115, 'y': 219},\n",
       "    'contour_left8': {'x': 123, 'y': 230},\n",
       "    'contour_left9': {'x': 136, 'y': 238},\n",
       "    'contour_right1': {'x': 245, 'y': 167},\n",
       "    'contour_right2': {'x': 241, 'y': 181},\n",
       "    'contour_right3': {'x': 236, 'y': 196},\n",
       "    'contour_right4': {'x': 230, 'y': 210},\n",
       "    'contour_right5': {'x': 223, 'y': 224},\n",
       "    'contour_right6': {'x': 213, 'y': 236},\n",
       "    'contour_right7': {'x': 201, 'y': 245},\n",
       "    'contour_right8': {'x': 186, 'y': 249},\n",
       "    'contour_right9': {'x': 169, 'y': 248},\n",
       "    'left_eye_bottom': {'x': 154, 'y': 141},\n",
       "    'left_eye_center': {'x': 155, 'y': 139},\n",
       "    'left_eye_left_corner': {'x': 144, 'y': 137},\n",
       "    'left_eye_lower_left_quarter': {'x': 149, 'y': 139},\n",
       "    'left_eye_lower_right_quarter': {'x': 160, 'y': 141},\n",
       "    'left_eye_pupil': {'x': 155, 'y': 137},\n",
       "    'left_eye_right_corner': {'x': 166, 'y': 142},\n",
       "    'left_eye_top': {'x': 156, 'y': 135},\n",
       "    'left_eye_upper_left_quarter': {'x': 149, 'y': 135},\n",
       "    'left_eye_upper_right_quarter': {'x': 161, 'y': 137},\n",
       "    'left_eyebrow_left_corner': {'x': 135, 'y': 121},\n",
       "    'left_eyebrow_lower_left_quarter': {'x': 145, 'y': 120},\n",
       "    'left_eyebrow_lower_middle': {'x': 154, 'y': 121},\n",
       "    'left_eyebrow_lower_right_quarter': {'x': 164, 'y': 124},\n",
       "    'left_eyebrow_right_corner': {'x': 174, 'y': 127},\n",
       "    'left_eyebrow_upper_left_quarter': {'x': 144, 'y': 114},\n",
       "    'left_eyebrow_upper_middle': {'x': 156, 'y': 113},\n",
       "    'left_eyebrow_upper_right_quarter': {'x': 167, 'y': 118},\n",
       "    'mouth_left_corner': {'x': 145, 'y': 198},\n",
       "    'mouth_lower_lip_bottom': {'x': 166, 'y': 209},\n",
       "    'mouth_lower_lip_left_contour1': {'x': 157, 'y': 199},\n",
       "    'mouth_lower_lip_left_contour2': {'x': 151, 'y': 203},\n",
       "    'mouth_lower_lip_left_contour3': {'x': 157, 'y': 206},\n",
       "    'mouth_lower_lip_right_contour1': {'x': 177, 'y': 204},\n",
       "    'mouth_lower_lip_right_contour2': {'x': 180, 'y': 211},\n",
       "    'mouth_lower_lip_right_contour3': {'x': 173, 'y': 211},\n",
       "    'mouth_lower_lip_top': {'x': 167, 'y': 201},\n",
       "    'mouth_right_corner': {'x': 185, 'y': 209},\n",
       "    'mouth_upper_lip_bottom': {'x': 168, 'y': 198},\n",
       "    'mouth_upper_lip_left_contour1': {'x': 165, 'y': 190},\n",
       "    'mouth_upper_lip_left_contour2': {'x': 154, 'y': 192},\n",
       "    'mouth_upper_lip_left_contour3': {'x': 157, 'y': 197},\n",
       "    'mouth_upper_lip_right_contour1': {'x': 175, 'y': 193},\n",
       "    'mouth_upper_lip_right_contour2': {'x': 182, 'y': 200},\n",
       "    'mouth_upper_lip_right_contour3': {'x': 178, 'y': 202},\n",
       "    'mouth_upper_lip_top': {'x': 170, 'y': 192},\n",
       "    'nose_contour_left1': {'x': 172, 'y': 143},\n",
       "    'nose_contour_left2': {'x': 163, 'y': 162},\n",
       "    'nose_contour_left3': {'x': 164, 'y': 176},\n",
       "    'nose_contour_lower_middle': {'x': 172, 'y': 180},\n",
       "    'nose_contour_right1': {'x': 190, 'y': 148},\n",
       "    'nose_contour_right2': {'x': 188, 'y': 169},\n",
       "    'nose_contour_right3': {'x': 180, 'y': 180},\n",
       "    'nose_left': {'x': 157, 'y': 171},\n",
       "    'nose_right': {'x': 188, 'y': 180},\n",
       "    'nose_tip': {'x': 176, 'y': 167},\n",
       "    'right_eye_bottom': {'x': 208, 'y': 155},\n",
       "    'right_eye_center': {'x': 209, 'y': 152},\n",
       "    'right_eye_left_corner': {'x': 198, 'y': 150},\n",
       "    'right_eye_lower_left_quarter': {'x': 203, 'y': 152},\n",
       "    'right_eye_lower_right_quarter': {'x': 214, 'y': 156},\n",
       "    'right_eye_pupil': {'x': 209, 'y': 151},\n",
       "    'right_eye_right_corner': {'x': 219, 'y': 157},\n",
       "    'right_eye_top': {'x': 210, 'y': 148},\n",
       "    'right_eye_upper_left_quarter': {'x': 204, 'y': 147},\n",
       "    'right_eye_upper_right_quarter': {'x': 216, 'y': 151},\n",
       "    'right_eyebrow_left_corner': {'x': 195, 'y': 133},\n",
       "    'right_eyebrow_lower_left_quarter': {'x': 206, 'y': 135},\n",
       "    'right_eyebrow_lower_middle': {'x': 218, 'y': 137},\n",
       "    'right_eyebrow_lower_right_quarter': {'x': 228, 'y': 140},\n",
       "    'right_eyebrow_right_corner': {'x': 237, 'y': 147},\n",
       "    'right_eyebrow_upper_left_quarter': {'x': 207, 'y': 129},\n",
       "    'right_eyebrow_upper_middle': {'x': 219, 'y': 130},\n",
       "    'right_eyebrow_upper_right_quarter': {'x': 231, 'y': 136}},\n",
       "   'attributes': {'gender': {'value': 'Male'},\n",
       "    'age': {'value': 35},\n",
       "    'smile': {'value': 0.0, 'threshold': 50.0},\n",
       "    'emotion': {'anger': 0.0,\n",
       "     'disgust': 0.0,\n",
       "     'fear': 0.0,\n",
       "     'happiness': 0.0,\n",
       "     'neutral': 99.98,\n",
       "     'sadness': 0.001,\n",
       "     'surprise': 0.019}}}],\n",
       " 'image_id': '7aTse7KQfdjLPPEMMCXy6Q==',\n",
       " 'face_num': 1}"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a7164c4e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
